package com.education.cms.common;

public class ResultModle {
    private int code;
    private String msg;
    private Object data;

    public ResultModle(){}

    public ResultModle(int code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public ResultModle(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResultModle(ResultCode resultCodeEnum){
        this.code=resultCodeEnum.getCode();
        this.msg=resultCodeEnum.getDesc();
    }

    public ResultModle(ResultCode resultCodeEnum,Object data){
        this.code=resultCodeEnum.getCode();
        this.msg=resultCodeEnum.getDesc();
        this.data=data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public static ResultModle ok(){return new ResultModle(ResultCode.CODE_00000); }

    public static ResultModle ok(Object data){return new ResultModle(ResultCode.CODE_00000,data); }

    public static ResultModle error(){return new ResultModle(ResultCode.CODE_00001); }

    public static ResultModle error(Object data){return new ResultModle(ResultCode.CODE_00001,data); }
}
